/**
 * @table: ${table.tableName}
 * @author : ${parametersConfig.author}
 * @date: ${date}
 * Code Generate By RateCode
 * Code Generate Gitee : https://gitee.com/GaopanL/rateCode
 */

package ${parametersConfig.packPath}.${module};

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import com.gopal.boot.common.core.domain.DataResponse;
import com.gopal.boot.common.core.domain.TableData;
import com.gopal.boot.common.log.annotation.Log;
import com.gopal.boot.common.log.enums.BusinessType;
import ${parametersConfig.packPath}.model.system.${table.tableNameConverted};
import ${parametersConfig.packPath}.service.system.${table.tableNameConverted}Service;

@Api(tags = "${table.tableNameHump}")
@RestController
@RequestMapping("${table.tableNameHump}")
public class ${table.tableNameConverted}Controller{

    @Autowired
    private ${table.tableNameConverted}Service ${table.tableNameHump}Service;

    @Log(title="${table.tableComment}", businessType=BusinessType.INSERT)
    @PostMapping("insert")
    @ApiOperation(value = "插入")
    public DataResponse insert(${table.tableNameConverted} ${table.tableNameHump}){
        return ${table.tableNameHump}Service.insert(${table.tableNameHump});
    }

    @PostMapping("queryByPage")
    @ApiOperation(value = "分页查询")
    public TableData queryByPage(${table.tableNameConverted} ${table.tableNameHump}){
        return ${table.tableNameHump}Service.queryByPage(${table.tableNameHump});
    }

    @PostMapping("queryById")
    @ApiOperation(value = "根据id查询")
    public DataResponse queryById(${table.fieldList[0].javaType} id){
        return ${table.tableNameHump}Service.queryById(id);
    }

    @Log(title="${table.tableComment}", businessType=BusinessType.UPDATE)
    @PostMapping("update")
    @ApiOperation(value = "修改")
    public DataResponse update(${table.tableNameConverted} ${table.tableNameHump}){
        return ${table.tableNameHump}Service.update(${table.tableNameHump});
    }

    @Log(title="${table.tableComment}", businessType=BusinessType.DELETE)
    @PostMapping("deleteById")
    @ApiOperation(value = "根据id删除")
    public DataResponse deleteById(${table.fieldList[0].javaType} id){
        return ${table.tableNameHump}Service.deleteById(id);
    }

}